/**
 * Copyright 2015 Software innovation and R & D center. All rights reserved.
 * File Name: BaseParamValidateInterceptor.java
 * Encoding UTF-8
 * Version: 0.0.1
 * History:	2016年7月24日
 */
package net.huashitong.ssydt.provider.security.interceptor;


import net.huashitong.ssydt.security.entity.UserSession;
import net.huashitong.ssydt.security.utils.UserUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;


/**
 * 基本校验
 *
 * @author huiyang.yu
 */
public class BaseParamValidateInterceptor extends ValidatorInterceptor {

    protected Logger logger = LoggerFactory.getLogger(getClass());

    /**
     * 基本校验
     */
    @Override
    protected boolean validate(HttpServletRequest request, HttpServletResponse response, Object handler) throws IOException {
        String userAgent = request.getHeader("User-Agent");
        UserSession userSession = new UserSession();
        userSession.setUserAgent(userAgent);
        UserUtils.getUserSession().set(userSession);

        return true;
    }


}
